package com.hj.dao;


import com.hj.domain.TableFields;
import com.hj.domain.Tables;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author hj
 */
@Mapper
public interface WorldDocumentDao {

    /**
     * 从数据库查找所有表
     *
     * @param dataName 数据库名
     * @return list-table
     */
    @Select("select table_name as name,table_comment as comment from information_schema.tables where table_schema =#{dataName} order by table_name")
    List<Tables> getAllTables(@Param("dataName") String dataName);

    /**
     * 从表名 查找所有的表字段
     *
     * @param tableName 表名
     * @return list-tableFields
     */
    @Select("SHOW FULL FIELDS FROM ${tableName}")
    List<TableFields> getTable(@Param("tableName") String tableName);


}
